package com.axonactive.yolo.service.internal;

import java.io.IOException;

import org.apache.http.client.ClientProtocolException;
import org.apache.log4j.Logger;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.scheduling.quartz.QuartzJobBean;

import com.axonactive.yolo.monitor.CheckUpdateCurrency;

public class QuartzJobDetectCurrency extends QuartzJobBean{

	private CheckUpdateCurrency checkUpdateCurrency;
	
	public void setCheckUpdateCurrency(CheckUpdateCurrency checkUpdateCurrency) {
		this.checkUpdateCurrency = checkUpdateCurrency;
	}

	@Override
	protected void executeInternal(JobExecutionContext context)
			throws JobExecutionException {
		if (CheckUpdateCurrency.ISFINISHED == true) {
			try {
				checkUpdateCurrency.run();
			} catch (IOException e) {
				Logger.getLogger(QuartzJobDetectCurrency.class).info("CheckUpdateCurrency",e);
			}
		}
	}

}
